package com.vipshop.core.base;


import org.springframework.data.domain.Example;
import org.springframework.data.domain.Sort;

import java.io.Serializable;
import java.util.List;

/**
 * @author sxzku
 * @version 1.0
 * @className BaseService
 * @description TODO
 * @date 2019/3/10 11:01
 **/
public interface BaseService<T,PrimaryKey extends Serializable>{
    T getById(PrimaryKey id);
    List<T> findAll();
    List<T> findAll(Sort sort);
    List<T> findAllById(Iterable<PrimaryKey> ids);
    void deleteInBatch(Iterable<T> entities);
    void deleteAllInBatch();
    List<T> findAll(Example<T> example);
    List<T> findAll(Example<T> example, Sort sort);
    T save(T entity);
    List<T> saveAll(Iterable<T> entities);
    T saveAndFlush(T entity);
}
